	<?php include $this->getViewFile('//layouts/onsale/header') ?>
    <!--以下为背景遮罩层-->
    <div class="spe-offer-container-bg">
        <div class="spe-offer-box-t">
            <img src="<?php echo yii::app()->theme->baseUrl;  ?>/assets/images/spe_offer_box_t.png" alt="妈咪街每日特价"/>
            <a href="javascript:void(0)" onclick="AddFavorite(window.location,document.title);"></a>
        </div>
        <div class="spe-offer-box-b" id="speOfferB">
            <div class="spe-offer-color">
                <div class="spe-offer-cl"></div>
                <div class="spe-offer-cr"></div>
            </div>
            <div class="spe-offer-box-nav">
                <div class="spe-offer-box-tab"></div>

                <ul class="clearfix spe-offer-nv">
                    <li class="spe-offer-nv-price">
                        <a href="<?php echo $this->createUrl('onsale') ?>" title="每日特价">
                            <p>今日特价</p>
                        </a>
                        <em></em>
                    </li>
                    <li class="spe-offer-nv-woman"><a href="<?php echo $this->createUrl('onsale', array('cid' => 1)) ?>" title="宝宝用品">
                        <em></em>
                        <p>宝宝用品</p></a></li>
                    <li class="spe-offer-nv-home"><a href="<?php echo $this->createUrl('onsale', array('cid' => 36)) ?>" title="宝宝食品">
                        <em></em>
                        <p>宝宝食品</p></a></li>
                    <li class="spe-offer-nv-ps"><a href="<?php echo $this->createUrl('onsale', array('cid' => 15)) ?>" title="童装童鞋">
                        <em></em>
                       <p>童装童鞋</p></a></li>
                    <li class="spe-offer-nv-baby"><a href="<?php echo $this->createUrl('onsale', array('cid' => 22)) ?>" title="玩具学习">
                        <em></em>
                        <p>玩具学习</p></a></li>
                    <li class="spe-offer-nv-man"><a href="<?php echo $this->createUrl('onsale', array('cid' => 29)) ?>" title="妈咪专区">
                        <em></em>
                        <p>妈咪专区</p></a></li>
                    <li class="spe-offer-nv-deg"><a href="<?php echo $this->createUrl('tomorrow') ?>" title="明日预告">
                        <em></em>
                        <p>明日预告</p></a></li>
                    </ul>

                <p></p>
            </div>
            <div class="spe-offer-goods clearfix" id="speOfferGoods">
            	<div class="spe-offer-goods-over clearfix">
                    <?php //include $this->getViewFile('data') ?>
            	</div>
            </div>
        </div>
    </div>
    <div class="spe-offer-bNav">
        <ul>
            <li class="spe-offer-bNav-top">
                <a href="javascript:;"></a>
            </li>
<!--             <li class="spe-offer-bNav-shop">
                <a href=""></a>
            </li> -->
        </ul>
    </div>
    <script src="<?php echo yii::app()->theme->baseUrl;  ?>/assets/js/speoffer.js"></script>
    <script type="text/javascript">
    	$(function(){
            //收藏
            $(document).on('click', '.collect', function(){
	    	//$(".collect").click(function(){
	    		var obj = $(this);
	    		var id = obj.data('id');
	    		$.post('<?php echo $this->createUrl('/front/goods/collect') ?>',{id:id},function(data){
	    			if(data.status){
	    				obj.find('strong').html(data.number);
	    			}else{
	    				alert(data.info);
	    			}
	    		},'json')
	    	})
            //滚动的时候事件
           HomePageAjax();  
           $(window).on('scroll', function(){
           //$(window).scroll(function() {
               var he = $(document).scrollTop() / $(document).height();
               if (he > 0.20) {
                   HomePageAjax();
               }
           });            		
    	})

        var URL = '<?php echo $this->createUrl(ACTION_NAME) ?>';
        var PAGE = 1;
        var CID = '<?php echo $cid; ?>';
        var _isAjaxsuo = false;
        function HomePageAjax(){
            console.log(PAGE);
            if (_isAjaxsuo) {
                return false;
            }
            _isAjaxsuo = true;
            $.ajax({
                url: URL,
                type: "post",
                timeout: 5000,
                dataType: "json",
                data:{page:PAGE,cid:CID},
                success: function(data) {
                    console.log(data);
                    if(data.status){
                        if(data.content == ''){
                            $(window).off('scroll');
                            //注销事件
                        }
                        $(".spe-offer-goods-over").append(data.content);
                        PAGE++;
                        _isAjaxsuo = false;  
                    }
                }
            });     
        }
    </script>